11840:
02506a7443155611d6bbf03e49fbf193e96d24db.
[HVM] Implement password authentication of VNC connections.
The specification is as mentioned at
http://lists.xensource.com/archives/html/xen-devel/2006-09/msg00666.html
(However, password came to describe plain text)
The difference is follows.
- protocol_authtype() without the necessity was deleted.
- The check on the protocol version was added.
- And, some small modification.
Signed-off-by: Masami Watanabe <masami.watanabe@jp.fujitsu.com>
# The tool used for initiating virtual TPM migration
#(external-migration-tool '')
+
+# The interface for VNC servers to listen on. Defaults
+# to 127.0.0.1 To restore old 'listen everywhere' behaviour
+# set this to 0.0.0.0
+#(vnc-listen '127.0.0.1')
+
+# The default password for VNC console on HVM domain.
+# Empty string is no authentication.
+(vncpasswd '')
dom0_vcpus_default = '0'
+ vncpasswd_default = None
+
"""Default interface to listen for VNC connections on"""
xend_vnc_listen_default = '127.0.0.1'
def get_vnclisten_address(self):
return self.get_config_value('vnc-listen', self.xend_vnc_listen_default)
+ def get_vncpasswd_default(self):
+ return self.get_config_value('vncpasswd',
+ self.vncpasswd_default)
+
def instance():
"""Get an instance of XendRoot.
Use this instead of the constructor.
sdl = sxp.child_value(config, 'sdl')
ret = []
nographic = sxp.child_value(config, 'nographic')
+
+ # get password from VM config (if password omitted, None)
+ vncpasswd_vmconfig = sxp.child_value(config, 'vncpasswd')
+
if nographic:
ret.append('-nographic')
+ # remove password
+ if vncpasswd_vmconfig:
+ config.remove(['vncpasswd', vncpasswd_vmconfig])
return ret
+
if vnc:
vncdisplay = sxp.child_value(config, 'vncdisplay',
int(self.vm.getDomid()))
+
vncunused = sxp.child_value(config, 'vncunused')
if vncunused:
ret += ['-vncunused']
else:
ret += ['-vnc', '%d' % vncdisplay]
+
ret += ['-k', 'en-us']
+
vnclisten = sxp.child_value(config, 'vnclisten')
if not(vnclisten):
- vnclisten = xen.xend.XendRoot.instance().get_vnclisten_address()
+ vnclisten = (xen.xend.XendRoot.instance().
+ get_vnclisten_address())
if vnclisten:
ret += ['-vnclisten', vnclisten]
+
+ vncpasswd = vncpasswd_vmconfig
+ if vncpasswd is None:
+ vncpasswd = (xen.xend.XendRoot.instance().
+ get_vncpasswd_default())
+ if vncpasswd is None:
+ raise VmError('vncpasswd is not set up in ' +
+ 'VMconfig and xend-config.')
+ if vncpasswd != '':
+ self.vm.storeVm("vncpasswd", vncpasswd)
+
+ # remove password
+ config.remove(['vncpasswd', vncpasswd_vmconfig])
+
return ret
def createDeviceModel(self):
fn=set_true, default=0,
use="Connect to the console after the domain is created.")
+gopts.var('vncpasswd', val='NAME',
+ fn=set_value, default=None,
+ use="Password for VNC console on HVM domain.")
+
gopts.var('vncviewer', val='no|yes',
fn=set_bool, default=None,
use="Spawn a vncviewer listening for a vnc server in the domain.\n"
for a in args:
if (vals.__dict__[a]):
config_image.append([a, vals.__dict__[a]])
+ config_image.append(['vncpasswd', vals.vncpasswd])
def run_bootloader(vals, config_image):
if not os.access(vals.bootloader, os.X_OK):